package com.dlc.shop.live.common.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dlc.shop.bean.param.LiveRoomParam;
import com.dlc.shop.common.util.PageAdapter;
import com.dlc.shop.common.util.PageParam;
import com.dlc.shop.live.common.dto.LiveRoomDto;
import com.dlc.shop.live.common.model.LiveRoom;
import com.dlc.shop.live.common.vo.LiveRoomVO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 *
 *
 * @author lhd
 * @date 2020-08-05 08:53:17
 */
public interface LiveRoomMapper extends BaseMapper<LiveRoom> {

    /**
     * 通过商品id获取直播间信息
     * @param prodId 商品id
     * @return 直播间信息
     */
    List<LiveRoomParam> getLivingRoomByProdId(@Param("prodId") Long prodId);

    /**
     * 获取直播间详细信息
     * @param page
     * @param liveRoom
     * @return
     */
    List<LiveRoomDto> pageRoomAndDetail(@Param("page") PageAdapter page, @Param("liveRoom") LiveRoomParam liveRoom);

    /**
     * 获取直播间详细信息
     * @param page
     * @param liveRoom
     * @return
     */
    long countRoomAndDetail(@Param("page") PageAdapter page, @Param("liveRoom") LiveRoomParam liveRoom);

    /**
     * 后台分页获取直播间信息
     * @param page
     * @param liveRoom
     * @return
     */
    IPage<LiveRoom> pageLiveRoom(PageParam<LiveRoom> page, @Param("liveRoom") LiveRoom liveRoom);

    /**
     * 根据参数获取直播间数量
     * @param shopId
     * @param userId
     * @param roomId
     * @param startTime
     * @param endTime
     * @return
     */
    int countRoomByParam(@Param("shopId") Long shopId, @Param("userId") String userId, @Param("roomId") Long roomId,
                         @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 获取需要踢出主播的直播间列表
     * @param userId
     * @return
     */
    List<Long> listLiveRoom(@Param("userId") String userId);

    /**
     * 获取用户当前正在开播的直播间信息
     * @param userId
     * @param roomId
     * @return
     */
    LiveRoomVO getLiveRoomInfo(@Param("userId") String userId, @Param("roomId") Long roomId);

    /**
     * 根据时间获取对应状态的直播间列表
     * @param liveStatus
     * @return
     */
    List<Long> listLiveRoomByStatus(@Param("liveStatus") Integer liveStatus);

    /**
     * 更新直播间状态
     * @param liveStatus
     * @param roomIds
     */
    void updateLiveRoomStatus(@Param("liveStatus") Integer liveStatus, @Param("roomIds") List<Long> roomIds);
}
